package com.example.cpms.mapper;

import jakarta.websocket.server.ServerEndpoint;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserMapper {

    /**
     * 通过用户名比对数据的账号和密码，如果都正确，则通过用户名查询用户id，使用id作为标识生成token信息
     * @param username
     * @return
     */
    @Select("select username from user where username=#{username}")
    String getUsername(@Param("username") String username);
    @Select("select password from user where username=#{username}")
    String getPassword(@Param("username") String username);
    @Select("select id from user where username=#{username}")
    String getId(@Param("username") String username);



    @Select("select sum(propertyFeePrice) from propety")//获得年度累积物业费总和数据
    Double getPropety();

    @Select("select count(*) from building") //获得楼宇数量
    Long getBuilding();

    @Select("select count(*) from rodManage") //获得一体杆数量
    Long getRod();

    @Select("select count(*) from warning") //获得告警记录条数
    Long getWarning();
}
